<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // 自己定义 数组扩展方法  求和 和 最大值 
    // Array.prototype.max = function () {
    //   return Math.max(...this) 
    // }
    // let arr = [1, 4, 6, 7]
    // console.log(arr.max());
    // Array.prototype.sum = function () {return this.reduce((prev, item) => prev + item, 0)}
    // let arr = [1, 4, 6, 7]
    // console.log(arr.sum());
    Array.prototype.min = function () {
      let min = this[0]
      for (let i = 0; i < this.length; i++) {
        min > this[i] ? this[i] : min
      }
      return min
    }
    let arr = [1, 3, 5, 6]
    console.log(arr.min());
  </script>
</body>

</html>